package com.molichuxing.services.infrastructure.dao;

import com.molichuxing.framework.dao.RootMapper;
import com.molichuxing.services.infrastructure.bean.ContractEnterpriseBean;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 合同表 Mapper 接口
 * </p>
 *
 * @author zhaopenghui
 * @since
 */
public interface ContractEnterpriseMapper extends RootMapper<ContractEnterpriseBean> {

    ContractEnterpriseBean getContractByOrderCode(@Param("orderCode") Long orderCode, @Param("carId") Integer carId, @Param("contractType") Integer contractType);

    List<ContractEnterpriseBean> getContractListByOrderCode(@Param("orderCode") Long orderCode, @Param("carId") Integer carId, @Param("contractType") Integer contractType);

    int getContractNoExist(@Param("contractNo") String contractNo);

    List<ContractEnterpriseBean> getContractMapByOrderCodes(@Param("orderCodes") List<Long> orderCodes);

    /**
     * 根据合同号和合同类型查询合同
     *
     * @param contractNo   合同号
     * @param contractType 合同类型
     * @return
     */
    ContractEnterpriseBean getByContractNo(@Param("contractNo") String contractNo, @Param("contractType") Integer contractType);

    /**
     * 修改无订单号的订单合同
     *
     * @param enterpriseBean
     * @return
     */
    int modifyOrderContract(ContractEnterpriseBean enterpriseBean);

    /**
     * 添加订单号
     *
     * @param contractId 合同id
     * @param orderCode  订单号
     * @return
     */
    int modifyOrderCode(@Param("contractId") Integer contractId, @Param("orderCode") Long orderCode);
}